<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="./bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css "/>
    <script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.1.1/jquery.min.js"></script>
    <script src="./bootstrap/js/bootstrap.js"></script>
    <script>
        function subInfo(){
            let mcontact = document.getElementById("inputmcontact").value;
            let mphone = document.getElementById("inputmphone").value;
            let maddress = document.getElementById("inputmaddress").value;
            let memail = document.getElementById("inputmemail").value;

            let merchantType = document.getElementById("inputmerchantType").value;
            let mrealName = document.getElementById("inputmrealName").value;
            let midCard = document.getElementById("inputmidCard").value;
            let midCardImg = document.getElementById("inputmidCardImg").value;

            if (mcontact ==='' || mphone ==='' || memail ==='' || maddress ==='' || merchantType ==='' || mrealName==='' ||midCard ==='' ||midCardImg ==='' ){
                document.getElementById("tipShow").innerHTML ='请填写完整信息......';
            return;
            }else {
            document.getElementById("tipShow").innerHTML = "";
            let obj ={mcontact :mcontact, mphone :mphone, memail :memail, maddress :maddress, merchantType :merchantType, mrealName:mrealName,midCard:midCard, midCardIng :midCardImg};
            $.ajax({
                type : "POST",
                url:"merchant/update",
                contentType:"application/json",
                dataType:"json",
                data:JSON.stringify(obj),
                success:function (data){
                    if (data.code ===200){
                        document.getElementById("tipShow").innerHTML ="资料提交成功，请耐心等待平台审核......";
                    }else {
                        document.getElementById("tipShow").innerHTML="资料提交失败，请重试......";

                    }
                },
                complete:function (res){
                    console.log('请求完成,',res)
                }
            })
          }
        }
    </script>
</head>
<body>
<div style="height: 20px;">
    <span id="tipShow" style="color: red"></span>
</div>
<form class="form-horizontal">
    <div class="form-group">
        <label for="inputmcontact" class="col-sm-2 control-label">商家联系人</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="inputmcontact" placeholder="请输入商家联系人">
        </div>
    </div>
    <div class="form-group">
        <label for="inputmphone" class="col-sm-2 control-label">联系方式</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="inputmphone" placeholder="请输入商家联系人">
        </div>
    </div>
    <div class="form-group">
        <label for="inputmemail" class="col-sm-2 control-label">联系邮箱</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="inputmemail" placeholder="请输入商家邮箱">
        </div>
    </div>
    <div class="form-group">
        <label for="inputmaddress" class="col-sm-2 control-label">联系地址</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="inputmaddress" placeholder="请输入商家地址">
        </div>
    </div>
    <div class="form-group">
        <label for="inputmerchantType" class="col-sm-2 control-label">商家类型</label>
        <div class="col-sm-8">
            <select class="form-control" id="inputmerchantType">
                <option value="o">个人</option>
                <option value="1">企业</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label for="inputmrealName" class="col-sm-2 control-label">商家真实名称</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="inputmrealName" placeholder="请输入商家真实名称">
        </div>
    </div>
    <div class="form-group">
        <label for="inputmidCard" class="col-sm-2 control-label">商家证件号</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="inputmidCard" placeholder="请输入商家证件号">
        </div>
    </div>
    <div class="form-group">
        <label for="inputmidCardImg" class="col-sm-2 control-label">商家证件图</label>
        <div class="col-sm-8">
            <input type="file"  id="inputmidCardImg">
        </div>
    </div>

</form>
<div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
        <button type="button" class="btn btn-success" onclick="subInfo()">提交</button>
    </div>
</div>
</body>
</html>